package com.ruoyi.business.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.business.domain.Fucker;
import com.ruoyi.business.service.IFuckerService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 好像有大病Controller
 * 
 * @author zw
 * @date 2021-10-09
 */
@Controller
@RequestMapping("/business/fucker")
public class FuckerController extends BaseController
{
    private String prefix = "business/fucker";

    @Autowired
    private IFuckerService fuckerService;

    @RequiresPermissions("business:fucker:view")
    @GetMapping()
    public String fucker()
    {
        return prefix + "/fucker";
    }

    /**
     * 查询好像有大病列表
     */
    @RequiresPermissions("business:fucker:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(Fucker fucker)
    {
        startPage();
        List<Fucker> list = fuckerService.selectFuckerList(fucker);
        return getDataTable(list);
    }

    /**
     * 导出好像有大病列表
     */
    @RequiresPermissions("business:fucker:export")
    @Log(title = "好像有大病", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(Fucker fucker)
    {
        List<Fucker> list = fuckerService.selectFuckerList(fucker);
        ExcelUtil<Fucker> util = new ExcelUtil<Fucker>(Fucker.class);
        return util.exportExcel(list, "好像有大病数据");
    }

    /**
     * 新增好像有大病
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存好像有大病
     */
    @RequiresPermissions("business:fucker:add")
    @Log(title = "好像有大病", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(Fucker fucker)
    {
        return toAjax(fuckerService.insertFucker(fucker));
    }

    /**
     * 修改好像有大病
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        Fucker fucker = fuckerService.selectFuckerById(id);
        mmap.put("fucker", fucker);
        return prefix + "/edit";
    }

    /**
     * 修改保存好像有大病
     */
    @RequiresPermissions("business:fucker:edit")
    @Log(title = "好像有大病", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(Fucker fucker)
    {
        return toAjax(fuckerService.updateFucker(fucker));
    }

    /**
     * 删除好像有大病
     */
    @RequiresPermissions("business:fucker:remove")
    @Log(title = "好像有大病", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(fuckerService.deleteFuckerByIds(ids));
    }
}
